package com.jxzn.locust.utils;

import java.util.UUID;

public final class Tools {

    /**
     * 获取验证码.
     * 
     * @return
     */
    public static String getSmsCode() {
        String[] n = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
        int size = 4;
        String result = "";
        int index = 0;
        for (int i = 0; i < size; i++) {
            index = (int) Math.floor(Math.random() * 10);
            result += n[index];
        }
        return result;
    }

    public static String getUUID() {
        return UUID.randomUUID().toString().replace("-", "");
    }

    public static int randomCode() {
        return (int) Math.round(Math.random() * 80000000) + 10000000;
    }
}
